<template>
    <div class="Counter">
        <!-- 数据统计 -->
        <div class="title">
            <p>数据统计</p>
            <img src="../../images/dataScreen-title.png" alt="图片地址已失效" />
        </div>
        <div class="charts" ref="refForCharts"></div>
    </div>
</template>

<script lang="ts" setup name="Counter">
import { ref, onMounted } from 'vue'
import * as echarts from 'echarts'
let refForCharts = ref<HTMLDivElement>() // 获取图表所在的DOM元素
onMounted(() => {
    let instanceOfEcharts = echarts.init(refForCharts.value as HTMLDivElement)
    let option = {
    title: {
      text: '游客消费统计',
      left:'right',
      textStyle:{
        color:'white',
      }
    },
    radar: {
      // shape: 'circle',
      indicator: [
        { name: '消费', max: 6500 },
        { name: '好感', max: 16000 },
        { name: '出行', max: 30000 },
        { name: '小吃', max: 38000 },
        { name: '爱好', max: 52000 },
        { name: '景点', max: 25000 }
      ]
    },
    series: [
      {
        name: 'Budget vs spending',
        type: 'radar',
        data: [
          {
            value: [4200, 3000, 20000, 35000, 50000, 18000],
            name: '购物'
          },
          {
            value: [5000, 14000, 28000, 26000, 42000, 21000],
            name: '吃饭'
          }
        ]
      }
    ],
    grid: {
      top: 20,
      left: 20,
      right: 20,
      bottom: 20,
    },
  };
    instanceOfEcharts.setOption(option)
})
</script>

<style lang="scss" scoped>
.Counter {
    width: 100%;
    height: 100%;
    background: url(../../images/dataScreen-main-lb.png) no-repeat;
    background-size: 100% 100%;
    margin-top: 20px;

    .title {

        // margin-left: 5px;
        p {
            color: white;
            font-size: 20px;
        }
    }

    .charts {
        width: 100%;
        height: calc(100% - 30px);
    }
}
</style>